import React from "react"
import {HISTORY_BASENAME} from "@/common/common";
import {RouteConfig} from "react-router-config";

const CompanyList = React.lazy(() => import("@/pages/company"))
const TenantList = React.lazy(() => import("@/pages/tenant"))
const ThemeConfig = React.lazy(() => import("@/pages/ThemeConfig"))

const Login = React.lazy(() => import("@/pages/login"))
const Log = React.lazy(() => import("@/pages/log/Log"))
const SQLQuery = React.lazy(() => import("@/pages/sql/sql-query"))

export function createRoutes() {
  const baseUrl = HISTORY_BASENAME;
  const routes: RouteConfig[] = [
    {
      path: `/platform/opex/theme`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <ThemeConfig {...props} />
        </React.Suspense>
      ),
    },
    {
      path: `/platform/resource/dict`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <TenantList {...props} />
        </React.Suspense>
      ),
    },
    {
      path: `/platform/resource/menu`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <TenantList {...props} />
        </React.Suspense>
      ),
    },
    {
      path: `/platform/application/list`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <CompanyList {...props} />
        </React.Suspense>
      ),
    },
    {
      path: `/platform/company/list`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <CompanyList {...props} />
        </React.Suspense>
      ),
    },
    {
      path: `/platform/tenant/list`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <TenantList {...props} />
        </React.Suspense>
      ),
    },
    {
      path: `${baseUrl}home`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <CompanyList {...props} />
        </React.Suspense>
      ),
    },
    {
      path: `${baseUrl}about`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <CompanyList {...props} />
        </React.Suspense>
      ),
    },
    {
      path: `${baseUrl}log`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <Log {...props} />
        </React.Suspense>
      ),
    },
    {
      path: `${baseUrl}database/sql-query`,
      component: (props: any) => (
        <React.Suspense fallback={<div/>}>
          <SQLQuery {...props} />
        </React.Suspense>
      ),
    }
  ]
  return routes
}
